package com.rongxun.common.base;

import com.alibaba.android.arouter.launcher.ARouter;
import com.rongxun.api.ApiManager;
import com.rongxun.common.BuildConfig;
import com.rongxun.common.utils.AppUtils;

import androidx.multidex.MultiDexApplication;

/**
 * Description: <初始化应用程序><br>
 * Author:      mxdl<br>
 * Date:        2018/6/6<br>
 * Version:     V1.0.0<br>
 * Update:     <br>
 */
public class BaseApplication extends MultiDexApplication {

    private static BaseApplication mApplication;

    @Override
    public void onCreate() {
        super.onCreate();
        mApplication = this;

        ARouter.init(this);

        if (BuildConfig.IS_DEBUG) {
            ARouter.openLog();
            ARouter.openDebug();
        }

        AppUtils.init(this);

        ApiManager.getInstance().init(this);
    }

    public static BaseApplication getInstance() {
        return mApplication;
    }

    @Override
    public void onTerminate() {
        super.onTerminate();
        ARouter.getInstance().destroy();

    }
}
